package com.qubuyer.business.auth.viewmodel

import androidx.lifecycle.MutableLiveData
import com.qubuyer.business.auth.model.AuthModel
import com.qubuyer.core.anno.AutoInject
import com.qubuyer.core.framework.BaseViewModel
import com.qubuyer.core.http.RetrofitCall
import com.qubuyer.repository.entitys.LoginEntity

/**
 * Author: linwg
 * Time: 2021/3/4 0004
 * Description:
 */
class SetPwdViewModel : BaseViewModel() {
    @AutoInject
    private val authModel = AuthModel()
    val thirdPartLoginResult = MutableLiveData<Int>()

    fun setPwd(token: String?, inviteCode: String, pwd: String, secondPwd: String) {
        RetrofitCall<LoginEntity?>(lifecycleOwner, this) {
            api { authModel.setPwd(token ?: "", inviteCode, pwd, secondPwd) }
            success {
                thirdPartLoginResult.value = 200
            }
        }
    }

}